﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class MyCartList : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        this.Page.Title = "我的购物清单";

      
            if (!IsPostBack)
            {
                if (Session["user"] == null)
                { }//会员没有登录
                else
                {
                    string user = Session["user"].ToString();
                    DbAccess db = new DbAccess();
                    //根据会员编号，查询对应的购物清单
                    DataSet cList = db.GetDataSet("select * from cartlist where userid='" + user + "'");
                    gdList.DataSource = cList.Tables[0].DefaultView;
                    gdList.DataBind();

                }
        }
    }

    protected void gdList_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        //创建详细链接
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            e.Row.Cells[4].Text = "<a href='Detail.aspx?sid=" + e.Row.Cells[3].Text + "'>详细</a>";

        }
    }
}
